/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dnl.util.ui;

import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.Window;

/**
 * 
 * @author daniel
 */
public class OkDialog extends Dialog {

	public OkDialog() {
		initComponents();
	}

	public OkDialog(Dialog owner, boolean modal) {
		super(owner, modal);
		initComponents();
	}

	public OkDialog(Dialog owner, String title, boolean modal) {
		super(owner, title, modal);
		initComponents();
	}

	public OkDialog(Dialog owner, String title) {
		super(owner, title);
		initComponents();
	}

	public OkDialog(Dialog owner) {
		super(owner);
		initComponents();
	}

	public OkDialog(Frame owner, boolean modal) {
		super(owner, modal);
		initComponents();
	}

	public OkDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) {
		super(owner, title, modal, gc);
		initComponents();
	}

	public OkDialog(Frame owner, String title, boolean modal) {
		super(owner, title, modal);
		initComponents();
	}

	public OkDialog(Frame owner, String title) {
		super(owner, title);
		initComponents();
	}

	public OkDialog(Frame owner) {
		super(owner);
		initComponents();
	}

	public OkDialog(Window owner, ModalityType modalityType) {
		super(owner, modalityType);
		initComponents();
	}

	public OkDialog(Window owner, String title, ModalityType modalityType) {
		super(owner, title, modalityType);
		initComponents();
	}

	public OkDialog(Window owner, String title) {
		super(owner, title);
		initComponents();
	}

	public OkDialog(Window owner) {
		super(owner);
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jPanel1 = new javax.swing.JPanel();
		okJB = new javax.swing.JButton();
		cancelJB = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

		jPanel1.setPreferredSize(new java.awt.Dimension(400, 50));

		okJB.setText("OK");
		okJB.setPreferredSize(new java.awt.Dimension(70, 26));
		okJB.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				okJBActionPerformed(evt);
			}
		});
		jPanel1.add(okJB);

		cancelJB.setText("Cancel");
		cancelJB.setPreferredSize(new java.awt.Dimension(70, 26));
		cancelJB.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				cancelJBActionPerformed(evt);
			}
		});
		jPanel1.add(cancelJB);

		getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);

		pack();
	}// </editor-fold>//GEN-END:initComponents

	private void cancelJBActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cancelJBActionPerformed
		setCancelled(true);
		setVisible(false);
	}// GEN-LAST:event_cancelJBActionPerformed

	private void okJBActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_okJBActionPerformed
		setCancelled(false);
		setVisible(false);
	}// GEN-LAST:event_okJBActionPerformed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		/*
		 * Set the Nimbus look and feel
		 */
		// <editor-fold defaultstate="collapsed"
		// desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase
		 * /tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(OkDialog.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(OkDialog.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(OkDialog.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(OkDialog.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/*
		 * Create and display the dialog
		 */
		java.awt.EventQueue.invokeLater(new Runnable() {

			@Override
			public void run() {
				OkDialog dialog = new OkDialog(new javax.swing.JFrame(), true);
				dialog.addWindowListener(new java.awt.event.WindowAdapter() {

					@Override
					public void windowClosing(java.awt.event.WindowEvent e) {
						System.exit(0);
					}
				});
				dialog.setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton cancelJB;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JButton okJB;
	// End of variables declaration//GEN-END:variables
}
